<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //课前分享，驼峰命名法
    function tf(str){
        let arr=str.split('-')
        let  newArr=''
        for(i=0;i<arr.length;i++){
            if(i>0){
                newArr+=arr[i].charAt(0).toUpperCase()+arr[i].substr(1,arr.length).toLowerCase()
            }else{
                newArr=arr[i].toLowerCase()
            }
        }
        return newArr
        
    }
    console.log(tf('get-element-by-id'));
</script>
</html>